﻿CREATE PROCEDURE temp.s_NotePhones AS
EXEC sp__Context_SecurityOff 1

DECLARE @Pattern sysname SET @Pattern = '\d\d\d\D{1}\d\d\d\D{1}\d\d\d\d'
UPDATE t_Note SET Phone = dbo.clr_RegEx_MatchGroup(Note,'('+@Pattern+')',1)
WHERE ISNULL(Phone,'') = '' AND dbo.clr_RegEx_Match(Note,@Pattern,1) = 1

EXEC sp__Context_SecurityOff 0
